Suppose that I use C# to run a long running SQL Server stored procedure (lets say 30 minutes). Further suppose that I put a 1 hour timeout period on the query in C# such tha
The timeout is something that happens on the connection, not the running query.
This means that your BEGIN CATCH will not execute in the event of a timeout, as the query has no idea about it.
BEGIN CATCH
Write your cleanup in C#, in a catch(SqlException ex) block (testing for a timeout).
catch(SqlException ex)