• try along these lines .....

    select * from Tname

    where (Tcol1 = @X OR Tcol1 is null)

    AND (Tcol2 = @Y OR Tcol2 is null)

    ---- OR -----

    select * from Tname

    where Tcol1 = case when @X is null then null

    when @X = 0 then null

    else @X end

    and

    Tcol2 = case when @Y is null then null

    when @Y = 0 then null

    else @Y end