First off, can I suggest that you only read the Sid and ContactId once per execution, and store them in a variable? Then ensure it returns only a single value:
DECLARE @SID INT
Set @SID = (SELECT TOP 1 Sid FROM MyTable WHERE Name=@Name)
Then use the variable in each of your updates.