Generally you want to get
SELECT SUSER_NAME()
from SQL Server - the connected user in the format DOMAIN\UserName .
Usually you do not have direct access to AD from the SQL Server computer to capture some bits from there .... if you cannot work with the DOMAIN\User Name value, it is best to go through this information from your calling application into a stored procedure.
source share