SELECT *
FROM A, B
WHERE A1 = @B1
AND (isnull(@B2,'') = '' OR A2 = @B2) -- use on string values
AND (@B3 IS NULL OR A3 = @B3) -- use on numeric and datetime values
SELECT *
FROM A, B
WHERE A1 = @B1
AND A2 = (CASE WHEN ISNULL(@B2,'') = '' THEN A2 ELSE @B2 END)
AND A3 = (CASE WHEN @B3 IS NULL THEN A3 ELSE @B3 END)
|