ICD10 codes need to be ordered appropriately, elderly patients can be admitted for a Primary Condition i.e. Cancer, but have dozens of other co-morbidities i.e. Asthma or Diabetes. SQL will return values in any order it feels like.Using TOP 12 could result in the primary Diagnosis being excluded.

When Clinicians populate their spreadsheets they are applying an ordering system (a cancer patient may be having an in-growing toe nail sorted out - so cancer is not the primary in this cases). Sometimes ICD10 & OPCS4 codes have to go in a special order, it's common to see a Primary 'Cxxx' code followed by a Secondary 'Dxxx' code.

Speak to your clinicians first about ordering logic? You need to have that before you go any further. All the best SQL solutions start with a good requirements document :)