The @@SERVICENAME is one of the Configuration functions used to return the registry key under which SQL Server is currently running. If it is a default instance, it will write MSSQLSERVER as the service name, and if it is a named instance, it will return the instance name. The syntax behind this is
The below code snippet will show the SQL Server service name we are currently running.
SELECT @@SERVICENAME AS 'Service Name'