To monitor the SQL activity and log executed queries, you can use a tool such as the SQL Server Profiler, which is a graphical user interface provided by Microsoft SQL Server.
You can also use the following stored procedures to create a trace that captures the executed SQL statements.
sp_trace_create
sp_trace_setevent
You can also visit the following link regarding above store procedures:
sp_trace_create (Transact-SQL) - SQL Server | Microsoft Learn[
^]