Someone knows the way to stop a process genetared
by command : EXEC master..xp_cmdshell PsCMD

For example:

I have this code to check pingable:

Set LsIPAddress = '';
Set PsCMD = 'ping ' + convert(varchar,LsIPAddress) + ' -
Insert into LogPing(Status) EXEC master..xp_cmdshell PsCMD
PRINT 'Process successful!'

But this continue doing it forever which it is ok.
But I just need to run it for 10 seconds and then stop it.

How I can do that? it is possible ?

Any help is greatly appreciated.