• Its because, semicolon missing at the end of return statement.

    Use the simplified one below :

    CREATE FUNCTION dbo.ExecuteStringAsQuery (@empID as nvarchar(500))

    RETURNS Varchar(8000)

    AS

    BEGIN

    /* Build Transact-SQL String with parameter value */

    return(select JoinDateQuery from NewHireEmployee where empid= + @empID);

    END