Yes. The student sort order can be changed at any time. If you change the student sort order after assigning student roll numbers, all students will be arranged based on the new sort order. However, the assigned roll numbers will remain the same.
At the top of your dashboard, click the module access icon > Administration > Settings > Manage student roll numbers to open the Manage roll number page.
Click Edit beside the previously set sort order.
In the dialogue box that opens, click Edit.
Change the student sort order, and then click the Save button.
The students will be arranged based on the new sort order, but the previously assigned roll numbers will remain the same.
For more information, watch this-