You can use the built-in TRANSACTION function in your procedures to determine whether a transaction is currently active. This LOGICAL function returns TRUE if a transaction is active and FALSE otherwise. You might use this, for example, in a subprocedure that is called from multiple places and which needs to react differently depending on whether its caller started a transaction. (When you have a single procedure, you should not need this function to tell you if a transaction is active!)