In my sql there is IF (expr1, expr2, expr3).
How to do it in MS SQL?
You can use the CASE expression :
CASE WHEN expr1 THEN expr2 ELSE expr3 END
By the way, this syntax is not specific to SQL Server - it also works in MySQL and most other databases.