I have an awkward problem. I'm debugging what I believe is a race condition in a legacy codebase. The issue involves a userID column being set to the wrong value. Essentially, one user's record will be non-deterministically reassigned to another user. The real problem is that this column is set from several different stored procedures, and there's no logging, so I don't even know where to start.
I was thinking of creating an update trigger on the column, and log the "to" and "from" values, but this doesn't really help me if I don't know what procedure's doing the update. Is there anyway to log the procedure doing the update from inside the trigger?