rewrite below without dynamic sql string

CREATE Procedure [Barrington].[ContractorSearchByPage]
(
	@CompanyId uniqueidentifier,
	@Status nvarchar(100),
	@Search nvarchar(100),
	@PageNumber int,
	@PageSize int,
	@Alphabet nvarchar(10),
	@ManagedBy uniqueidentifier,
	@CompliantStatus nvarchar(100),
	@TradeName nvarchar(100)='',
	@LocationId uniqueidentifier
)
AS

BEGIN
    DECLARE @SQL nvarchar(max);

    SET @SQL = '
select
	Distinct
	CC.Id as ContractorCompanyId,
	C.Id as ContractorId,
	C.Name as ContractorName,
	C.LegalName as ContractorLegalName,
	CC.RedeemCode,
	CC.CompanyId as CustomerId,
	CO.Name as CustomerName,
	CO.Phone as CustomerPhone,
	CO.Email as CustomerEmail,
	C.ABN,
	CC.StartDate,
	CC.EndDate,
	CC.IsPrimary,
	CC.LinkType,
	CC.LinkModel,
	dbo.fn_GetAddress(C.Id, ''CompanyAddress'', C.Id) as CompanyAddress,
	dbo.fn_GetAddress(C.Id, ''CompanyMailAddress'', C.Id) as MailingCompanyAddress,
	C.Phone,
	C.Email,
	C.Website, 
	C.TimeZoneOffset,
	CC.Relationship,
	CC.Status AS [Status],
	CC.StatusChangeDate,
	CC.CompliantStatus,
	CC.CompliantStatusDate,
	CC.CreatedDate,
	
	C.IsSoleTrader,
	[dbo].[fn_GetCompanyRole] (CC.ContractorId, CC.CompanyId) as DisplayCompanyTradeRole,
	CO.Status as CompanyStatus,
	dbo.fn_GetManagedBy(CC.Id) as ManagedByName,
	Count(*) over (partition by CC.CompanyId)  AS TotalCount
From Barrington.Company C
	inner join Barrington.CompanyContractor CC on CC.ContractorId = C.Id
	inner join Barrington.Company CO on CO.Id = CC.CompanyId
	';

    IF @LocationId != 0x0
    BEGIN
        SET @SQL = @SQL + '
        INNER JOIN [dbo].[vwContractorAccessLocation] VCAL ON CC.ContractorId = VCAL.ContractorId 
            AND VCAL.LocationId = @LocationId 
            AND VCAL.status = ''Approved''
        ';
    END

	SET @SQL = @SQL + '

	left join Barrington.ContactAddress CA on CA.ReferenceId = CC.Id 
		and CA.IsDeleted = 0
where (CC.Relationship = ''Contractor'' or CC.Relationship = ''Supplier'')
	and CC.CompanyId = @CompanyId
	AND ((SUBSTRING(C.Name, 1, 1) = @Alphabet) OR @Alphabet = ''All'')
	and (@CompliantStatus =''All'' OR CC.CompliantStatus = @CompliantStatus)
	and (@ManagedBy = 0x0 OR CA.EmployeeId = @ManagedBy)
	and (@Status =''All'' OR CC.Status = @Status)
	and C.IsDeleted = 0
	and CC.IsDeleted = 0
	and CO.IsDeleted = 0
	and C.Status != ''Archived''
	and CO.Status != ''Archived''
	
	and [dbo].[fn_GetCompanyRole] (CC.ContractorId, CC.CompanyId) like ''%'' + @TradeName + ''%''
	and (
			C.Name like ''%'' + @Search + ''%''
			OR C.LegalName like ''%'' + @Search + ''%''
			
			OR C.Abn like ''%'' + @Search + ''%''
			OR dbo.fn_GetAddress(C.Id, ''CompanyAddress'', C.Id) like ''%'' + @Search + ''%''
			OR C.Phone like ''%'' + @Search + ''%''
			OR C.Email like ''%'' + @Search + ''%''
			OR CC.RedeemCode like ''%'' + @Search + ''%''
		)	
		Group By CC.Id,
		C.Id,
		C.Name,
		C.LegalName,
		CC.RedeemCode,
		CC.CompanyId,
		CO.Name,
		CO.Phone,
		CO.Email,
		C.ABN,
		CC.StartDate,
		CC.EndDate,
		CC.IsPrimary,
		CC.LinkType,
		CC.LinkModel,
		C.Phone,
		C.Email,
		C.Website, 
		C.TimeZoneOffset,
		CC.Relationship,
		CC.Status,
		CC.StatusChangeDate,
		CC.CompliantStatus,
		CC.CompliantStatusDate,
		CC.CreatedDate,		
		C.IsSoleTrader,
		CO.Status,
		CC.ContractorId
Order by C.Name
OFFSET  ((@PageNumber -1) * @PageSize)  ROWS 
FETCH NEXT @PageSize ROWS ONLY
';

    EXEC sp_executesql @SQL,
        N'@CompanyId uniqueidentifier, @Status nvarchar(100), @Search nvarchar(100), @PageNumber int, @PageSize int, @Alphabet nvarchar(10), @ManagedBy uniqueidentifier, @CompliantStatus nvarchar(100), @TradeName nvarchar(100), @LocationId uniqueidentifier',
        @CompanyId = @CompanyId,
        @Status = @Status,
        @Search = @Search,
        @PageNumber = @PageNumber,
        @PageSize = @PageSize,
        @Alphabet = @Alphabet,
        @ManagedBy = @ManagedBy,
        @CompliantStatus = @CompliantStatus,
        @TradeName = @TradeName,
        @LocationId = @LocationId;
END;