I have created a stored procedure in my SQL Server Express that I am calling my Web API in and it is running fine. I want it to play in the background like a job / schedule using waitfor time in SQL Server to auto start it at startup of master.
Stored procedure:
USE [master]
CREATE PROCEDURE [dbo].[MyBackgroundTask]
AS
BEGIN
    SET NOCOUNT ON;
    DECLARE @timeToRun NVARCHAR(50)
    SET @timeToRun = 'time'
    WHILE 1 = 1
    BEGIN
        WAITFOR time @timeToRun
        BEGIN
            EXECUTE [master].[dbo].[CALLWEBSERVICE];
        END
    END
END
To start with the master startup I have used sp_procoption:
sp_procoption    @ProcName = 'MyBackgroundTask',
                @OptionName = 'startup',
                @OptionValue = 'on'
GO
I have also used this query to get the list of routine task running in background:
SELECT ROUTINE_NAME
FROM MASTER.INFORMATION_SCHEMA.ROUTINES
WHERE OBJECTPROPERTY(OBJECT_ID(ROUTINE_NAME),'ExecIsStartup') = 1
I have also got it running in background but how can I check if it is really working in background how can I check the result I got in background running stored procedure?
I tried SQL Server Express Profiler but not helpful it is not showing background procedures in it.
 
    