A basic template for transactions in a stored procedure.

BEGIN TRANSACTION

-- do updates etc 

IF @@ERROR <> 0 
	ROLLBACK TRANSACTION
ELSE
	COMMIT TRANSACTION