That's not an easy task at all and you would need a plugin to accomplish that properly. This one will do it (ignore that their demo fails as the download works fine). You can probably find many other similar also but you will most likely need to revise your tables.
It's a complicated task because the header needs to be cloned and placed into position but then you also need to match the widths of the header with the widths of the table as they must work together in a responsive layout.
If position:sticky was fully supported on 'th' elements then it would be so easy in CSS alone as this works a treat in webkit only (chrome etc.).