Some logins may want to see queries that requested from the database.
They can see these queries from SQL Server DMWs(Dynamic Management View) and DMFs(Dynamic Management Functions).
However, to be able to query dmws and dmfs, the login must be granted VIEW_SERVER_STATE permission at the server level.
You can give this permission with the below script.
1 2 3 4 | USE [master] GO GRANT VIEW SERVER STATE TO [Login_Name] GO |
When we give this permission to Login, it will be able to see the queries requested from every databases.
For information security, it is not appropriate for anyone to see queries requested from another database.
If you want to see only queries requested from your own databases without having the VIEW_SERVER STATE privilege, you can read my article named “How To Give Restrict Access To dmw and dmf To Logins Without Giving View_Server_State Permission“.