The CASE statement is the closest to IF in SQL and is supported on all versions of SQL Server ..... From this link: IF THEN ELSE in T-SQL ...
stackoverflow.com