This article guide on,
How to resolve SQL Server Error 15343? or Troubleshoot, Could not drop login
Why Error 15434: Could not drop login as the user is currently logged in coming?
When there is task to delete or drop user from SQL Server we have to make sure that no one is connected with that user in SQL server. If user is connected in SSMS or any application and when you try to drop that user we will get
Error 15434: Could not drop login as the user is currently logged in.
How to resolve , Error 15434: Could not drop login as the user is currently logged in?
When you receive Error 15434: Could not drop login as the user is currently logged in while dropping user from SQL Server. You need to identify the sessions in SQL Server connected using same login.
Run below query to find out user name.
select * from sys.sysprocesses where loginame = 'test'
This will give the list of session id currently log in on SQL Server. Once you have those session ID kill those session id using
Kill 100 -- 100 is session id
Once all session ID removed then try to drop login again and you will able to drop login successfully.
Drop login test