I wrote a T-SQL Statement similar like this (the original one looks different but I want to give an easy example here):
SELECT first_name + CASE last_na
The WHEN part is compared with ==, but you can't really compare with NULL. Try
CASE WHEN last_name is NULL THEN ... ELSE .. END
instead or COALESCE:
COALESCE(' '+last_name,'')
(' '+last_name is NULL when last_name is NULL, so it should return '' in that case)