I think there are two separate issues here. First, to directly answer your question, xp_cmdshell will let you call out to your script and retrieve its output (as long as its output is in the form of text written to the standard console at any rate). Remember you will have to use sp_config to enable xp_cmdshell and that this will expand your attack surface area (in other words, reduce security), so be sure you want to do this.
The second question is, are you sure this is the way you want to do it? You may get overall better results form a more generalized, polished tool such as SQL Monitor https://www.red-gate.com/products/dba/sql-monitor/
1 Person is following this question.