As xp_cmdshell is generally not available (unless one enables it, which some companies frown upon), a possible replacement for the code that checks for file existence is using xp_fileexist. Therefore the lines in between "temp proc to check backup file existence" become:
-- START create temp proc to check backup file existence
CREATE PROCEDURE dbo.#prFileExists
@path varchar(300) ,
@p2 int OUTPUT
AS BEGIN
IF object_id('tempdb..#cmdshell') IS NOT NULL
DROP TABLE #cmdshell
CREATE TABLE #cmdshell ([File Exists] int, [File is a Directory] int, [Parent Directory Exists] int)
INSERT INTO #cmdshell exec master..xp_fileexist @path
SELECT @p2 =[File Exists] from #cmdshell
END
GO
-- END create temp proc to check backup file existence