Select * from table Where (Name = @name OR @name is Null) AND (Gender = @gender OR @gender is Null) ... deve ser uma consulta