The APP_NAME function returns the name of the application for the current database connection if the application has set it. Run the following in SSMS;

SELECT APP_NAME();

This will return;

Microsoft SQL Server Management Studio - Query

There’s no method of setting this value within TSQL. To set this value you need to include an Application Name parameter in your connection string. For example;

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;Application Name=MyAppName;