I 'm not really sure why this happens we need to look at the source to find out ,but you can go around it by adding an extra field for the columns.
components
this.scrollableCols = [
{ field: 'checkBox', header: 'checkBox' },
{ field: 'year', header: 'Year' },
{ field: 'brand', header: 'Brand' },
{ field: 'color', header: 'Color' },
{ field: 'year', header: 'Year' },
{ field: 'brand', header: 'Brand' },
{ field: 'color', header: 'Color' }
];
template
<p-table [columns]="scrollableCols" [frozenColumns]="frozenCols" [value]="cars1" [scrollable]="true"
scrollHeight="200px" frozenWidth="300px">
<ng-template pTemplate="colgroup" let-columns>
<colgroup>
<col *ngFor="let col of columns" style="width:300px;">
</colgroup>
</ng-template>
<ng-template pTemplate="header" let-columns>
<tr>
<!-- <th>
<p-tableHeaderCheckbox></p-tableHeaderCheckbox>
</th> -->
<th *ngFor="let col of columns" style="height:35px">
<ng-container *ngIf="col.field === 'checkBox' else baseTemp">
<p-tableHeaderCheckbox></p-tableHeaderCheckbox>
</ng-container>
<ng-template #baseTemp>
{{col.header}}
</ng-template>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr>
<!-- <td>
<p-tableCheckbox [value]="rowData"></p-tableCheckbox>
</td>
-->
<td *ngFor="let col of columns" style="height:35px">
<ng-container *ngIf="col.field === 'checkBox' else baseTemp">
<p-tableCheckbox [value]="rowData"></p-tableCheckbox>
</ng-container>
<ng-template #baseTemp>
{{rowData[col.field]}}
</ng-template>
</td>
</tr>
</ng-template>
</p-table>
in here ng-container *ngIf="col.field === 'checkBox' else baseTemp"
we check for columns with field checkbox then we add the p-tableCheckbox
component
demo