Abandoning stored proc execution from another session/connection
===

I have a costly stored procedure which runs after data in a table changes, in order to precalculate some aggregations of this data.  (The SP is called by the application rather than by a trigger on the table if that's relevant, though this is not a hard requirement).  The stored procedure is almost entirely a `INSERT INTO ... SELECT` statement.

The data generally changes infrequently (that is, the SP invocations are infrequent) but they can in principle overlap.  To ensure consistency in this case, I use `sp_getapplock` so that the second invocation will wait for the first to complete before proceeding.

This works but the wait is inefficient and unnecessary - the first thing that my stored procedure does is delete all existing (now-outdated) data.  What I really want is for the second invocation to tell the first one "don't bother carrying on with what you're doing, things have now changed - just stop running and I'll leave things in a correct state".

Is there a solid way for the second invocation to reliably abort the first SP invocation in this case?