Using MSSQL, what is the best method for handling locking in a stored procedure for doing batch updates in a while loop? Doing calculations, updates, inserts and deletes in the loop.