WHILE (@retry > 0) -- retry update if deadlock victim
BEGIN
  BEGIN TRY
    BEGIN TRANSACTION;
      UPDATE ....
      SET @retry = 0;
    COMMIT TRANSACTION;
  END TRY
  BEGIN CATCH 
    IF (ERROR_NUMBER() = 1205) -- deadlock victim
       SET @retry = @retry - 1; 
    ELSE
       SET @retry = -1;
    EXECUTE usp_PrintError;
    IF XACT_STATE() <> 0
      ROLLBACK TRANSACTION;
  END CATCH;
END;


