How can I automate the process of checking of column and executing SQL statement?
Question is not clear to me but

update 
    MyData
set 
    Value = @id
where 
    ColumnName in ('MyServiceName', 'MyServiceName2')