Short circuiting in TSQL expressions is not deterministic. Use a CASE statement which is guaranteed to evaluate in order