• Lacking further information this is the best I can provide. You will have figure out the rest.

    declare @SQLCmd nvarchar(max),

    @sparams nvarchar(max);

    set @sparams = N'@ResType varchar(8000), @StatusCode varchar(max)';

    set @SQLCmd =

    N'

    SELECT DISTINCT

    AL1.user_id_entered,

    AL1.reservation_id,

    AL1.start_date,

    AL1.status_code,

    AL1.actual_minutes,

    AL1.scheduled_minutes,

    AL1.customer_abbr,

    AL2.company_name,

    AL2.parent_company,

    AL1.reservation_name,

    AL1.product,

    AL1.customer_extend,

    AL1.category_abbr,

    AL1.reason_code,

    LEFT(DATENAME(MONTH, AL1.start_date), 3) AS StartDateMonth,

    YEAR(AL1.start_date) AS StartDateYear,

    ''Q'' + cast(datepart(quarter,AL1.start_date) as varchar) as StartDateQuarter

    FROM

    vbus_dss.dbo.adt_reservations AL1

    inner join dbo.company AL2

    on (AL1.customer_abbr = AL2.company_abbr)

    WHERE

    -- ('' + @OperParam + @Date_String + '' AND -- this part commented as I do not know what is trying to accomplish

    AL1.reservation_type IN (select Item from dbo.DelimitedSplit8K(@ResType,'','')) AND

    AL1.status_code IN (select Item from dbo.DelimitedSplit8K(@StatusCode,'',''));

    ';

    -- Display generated code

    print @SQLCmd;

    -- Execute generated code

    exec sp_executesql @SQLCmd, @sparams, @ResType, @StatusCode;