select * from 表 where 1=1
and
1=case when isnull(参数变量,'')='' then 1 else
case when 列=参数变量 then 1 else 0
end