Please look that alias name. I hope to set the value into a string var. How to put single quote inside a string which is in single quote.
SET @SQLString = N'SELECT purDetQty as 'detQty',stkBatchCode as 'batchCode',purDetProductId as 'productId'
INTO #ProductTable FROM PurchaseDetail
INNER JOIN Stock on stkId=purDetStockId
WHERE purDetID=@detId'