Correctly sort the field names when there are 10 or more columns in the dataset

Correctly sort the field names when there are 10 or more columns in the dataset. Previously was sorting in alpha sequence.
Only checked with sql output, you need to confirm it doesn't harm any other output formats.

Thanks
Tim