• Sorry, I should use this instead of my last post:

    CREATE PROCEDURE sp_MySearch

    @p1 varchar(50),

    @p2 varchar(50)

    As

    select * from t

    where

    isnull(c1, isnull(@p1,'')) like case when len(isnull(@p1,'')) =0 then isnull(c1, '') else '%'+@p1+'%' end and

    isnull(c2, isnull(@p2,'')) like case when len(isnull(@p2,'')) =0 then isnull(c2, '') else '%'+@p2+'%' end