Try using the On Element Appear activity, which will act as a container,
You can also try the Find Element activity, as you already stated that the Popup Window will appear as soon as your query finishes.
Depending on the time required for the query to complete you may or may not need to increase the TimeoutMS property
I suggest you to start with the Desktop Recorder, and then change selectors and properties accordingly if required.