T-SQL: Kill all inactive sessions from specific user
The SQL statement below will kill all sessions from a specific user, which wasn’t active the last hour.Of course, change ‘my_user’ with your preferred userid. If you want you can also uncomment the ‘program_name’ if you want to filter on program name.