UDF in MS SQL Server returning a query starting with "with" cause
you are mixing procedure and function

for UDF, your syntax should be
CREATE or alter function x (@__employee_id uniqueidentifier)
returns table
AS
RETURN (
with t as (select 'a' as attr)
select * from t
);