



CREATE procedure DBO.ListInstances (@database varchar(50), @module varchar(50)) as
SET NOCOUNT ON
--declare @database varchar(50)  set @database = 'techotel picasso'
--declare @module varchar(50)    set @module   = 'cashier.exe'
select distinct program_name, hostname, master..sysprocesses.hostprocess from master..sysprocesses WITH (nolock) 
inner join master..sysdatabases WITH (nolock) 
  on master..sysdatabases.dbid = master..sysprocesses.dbid
where master..sysdatabases.name = @database
and master..sysprocesses.program_name = @module

