create procedure show_lines @txt_filter varchar(100), @show_disabled bit as
select
*
from table
where
(@txt_filter is null or table.textfield like @txt_filter)
and
(@show_disabled is null or table.disabled = @show_disabled)select
....
from table
inner join chosenlink on chosenlink.targetid=table.id
where chosenlink.userid = ...