USE master


DECLARE @LinkedServerName NVARCHAR(128)='ARIZONACASH';
DECLARE @Result INT;

BEGIN TRY
    EXEC @Result = sp_testlinkedserver @LinkedServerName;
    PRINT 'Linked server is online.';
END TRY
BEGIN CATCH
    PRINT 'Linked server is offline or does not exist.';
    SELECT ERROR_MESSAGE();
END CATCH;