Which lock hints should I use (T-SQL)?

You may actually be better off setting the transaction isolation level rather than using a query hint.

The following reference from Books Online provides details of each of the different Isolation levels.

http://msdn.microsoft.com/en-us/library/ms173763.aspx

Here is good article that explains the various types of locking behaviour in SQL Server and provides examples too.

http://www.sqlteam.com/article/introduction-to-locking-in-sql-server


table hints

WITH (HOLDLOCK) allows other readers. UPDLOCK as suggested elsewhere is exclusive.

HOLDLOCK will prevent other updates but they may use the data that is updated later.

UPDLOCK will prevent anyone reading the data until you commit or rollback.

Have you looked at sp_getapplock? This would allow you to serialise this code (if it's the only update bit) without UPDLOCK blocking

Edit: The problem lies mainly in this code running in 2 different sessions. With HOLDLOCk or REPEATABLE_READ, the data will be read in the 2nd session before the 1st session update. With UPDLOCK, noone can read the data in any session.