You can try these extended stored procedures:
declare @mssqlservice nvarchar(100),
@sqlserveragent nvarchar(100)
select @mssqlservice = 'mssqlserver',
@sqlserveragent = 'sqlserveragent'
exec master..xp_servicecontrol N'QUERYSTATE', @mssqlservice
exec master..xp_servicecontrol N'QUERYSTATE', @sqlserveragent
I don't think you can always do this. If the sql server is down, your query won't run. you can use another live SQL server and make distributed query.