title: SQL Server : get at the name of the app causing an update in a trigger
body: <p>We're trying to pinpoint the source of some unexpected updates happening on a SQL Server table. What I'd like to do is create a trigger on that table monitoring that column we're interested in, and when updates occur, write some audit info into a separate table.</p>
  
  <p>Works great and fine for things like user name, date, old and new columns values (from the <code>Inserted</code> and <code>Deleted</code> trigger tables) - but I'd like more :-)</p>
  
  <p>In SQL Profiler, you can see the name of the app that's connected to SQL Server in the profiles - the part that can be defined in the connection string as <code>Application Name</code>:</p>
  
  <pre><code>Data Source=(local);Initial Catalog=AdventureWorks;
  Integrated Security=True;Application Name="My Application"
  </code></pre>
  
  <p>Is there any way in a T-SQL <code>FOR UPDATE</code> trigger to get at this information?</p>