 <p>Thanks @vercelli </p> <p>I got my answer with this query with your help.</p> <pre><code>Declare @ProdID int set @ProdID=1 DECLARE @columnName VARCHAR(1000) DECLARE @columnVal VARCHAR(1000) DECLARE @Query VARCHAR(1000) --Create dynamic column name SELECT @columnName =COALESCE(@columnName + ', ','')+'['+cast(rn as varchar(10))+'] AS [R'+cast(rn as varchar(10))+']', @columnVal =COALESCE(@columnVal + ',','')+'['+cast(rn as varchar(10))+']' FROM ( select distinct ROW_NUMBER () over (partition By VendorId order by QuotedAmount desc) as rn from tbl_Vendor_Quotation where [ProductRequestID]=@ProdID ) a print @columnName print @columnVal set @Query='select VendorId,'+@columnName+' from ( select VendorId, QuotedAmount, ROW_NUMBER () over (partition By VendorId order by QuotedAmount desc) as rn from tbl_Vendor_Quotation where [ProductRequestID]='+cast(@ProdID as varchar(10))+') t1 PIVOT ( max(QuotedAmount) for rn in ('+@columnVal+')) As PivotTable' exec (@Query) </code></pre>