While you could execute an anonymous T-SQL block, for a simple update I'd recommend changing this to a 'traditional' UPDATE statement and using bind variables. Something like
UPDATE [MyData]
SET Wo = @woToUpdate,
Code = @codeToUpdate
WHERE Wo = @woToMatch
AND Code = @codeToMatch
In general you should think DML operations as set operations, not something one should loop through.
For executing the statement using the bind variables, have a look at
Properly executing database operations[
^]