title: Switch approle on client side
body: <p>Currently I am working on a project where a winforms application works together with a sql server database. I want the following behavior:
  1) User connects before login to database with a db user with low permissions.
  2) When the user login the db checks if the user is administrator. If thats true the application role switches to the administrator application role. Else the user login with standard application role.</p>
  
  <p>The problem is that I can't execute the sp_setapprole in a stored procedure on the database and the winforms application needs the password of the administrator application role stored somewhere. Thats not safety for sure. So whats a possible workaround?</p>