Create an out parameter for your stored procedure. Inside the stored procedure, set the value to 1 for an existing object or 0 for a non-existent. Only deserialize the xml result of the stored procedure if the out parameter is 1.
CREATE PROCEDURE sp_GetObjectAsXml
(
@intId int,
@intExists int out
)
AS
BEGIN
SELECT 'hello world' WHERE 1 = @intId
SET @intExists = @@ROWCOUNT
END
-- Happy Path
DECLARE @intExists int
exec sp_GetObjectAsXml 1, @intExists out
SELECT @intExists -- results in 1
-- Sad Path
DECLARE @intExists int
exec sp_GetObjectAsXml 10, @intExists out
SELECT @intExists -- results in 0