Returning the title of a record I want to return the title of a record if one exists or the word 'invalid' if not:

    @ID int ,
    @Title nvarchar(50) output
    ...
if exists(select * from MyTable where ID=@ID)
    select @Title = (select Title from MyTable where ID=@ID);
else select @Title = 'invalid';


but I don't have a good feeling with this query.
Just do:

// Default value
select @Title = "invalid";

// If a record is found, replace "invalid" by the Title value
select @Title = Title from MyTable where ID=@ID;