• If you are using transactions, you can put the rollback statement at the beginning of the catch as follows:

    BEGIN CATCH;

    ROLLBACK;

    SET @Result = 0;

    -- re-raise the error to be caught in the calling process

    EXECUTE @Result = dbo.pReThrowErrorwithlogging @ProcedureName = @SPName, @logError = 1, @Debug = 1;

    END CATCH;

    That will allow the procedure to log the error.