protected Map<SortMeta, String> getSortableColumnHeaders(FacesContext context, DataTable component) {
        AtomicReference<String> headerLabel = new AtomicReference<>(null);

        Map<String, SortMeta> sortByAsMap = component.getSortByAsMap();
        Map<SortMeta, String> headers = new LinkedHashMap<>(sortByAsMap.size());
        for (SortMeta sortMeta : sortByAsMap.values()) {
            if (sortMeta.isHeaderRow()) {
                continue;
            }

            headerLabel.set(null);
            component.invokeOnColumn(sortMeta.getColumnKey(), (column) -> {
                String label = resolveColumnAriaHeaderText(context, column);
                headerLabel.set(label);
            });
            headers.put(sortMeta, headerLabel.get());
        }

        return headers;
    }
Encodes dynamic column. Allows to override default behavior.
primefaces/src/main/java/org/primefaces/component/datatable/DataTableRenderer.java