You have not created any function with a name dbo.myfunc(). Create the function, it will resolve your error.
create FUNCTION dbo.myfunc()
RETURNS int
AS
BEGIN
RETURN 100
END;
select case when exists(select name from sysobjects where name = 'myfunc') then dbo.myfunc() else 0 end;
-Prashanth