You can set up a trace or an X-Event session capturing RPC:Starting and SQL:BatchStarting and which is filtered for these databases. You may also have to filter out things like the Telemetry session if you are on SQL 2016 or later.
Beware that even if the trace/X-Event session is filtered it will affect all processes, and if this is a system with very many, but, short commands, this can incur a significant overhead.