In our own project we do the following:

1) Determine what objects are visible, by querying every object and filling a visible object list. The visibility test is actually a rectangle intersection test between the object's bounding rectangle and the screen, which can be arbitrary. The resulting list is called "auxiliary" and consists of pointers to actual game objects (game objects are stored in doble-linked list).

2) Sort the auxiliary list using the popular QuickSort algorithm using each object's "ViewOrder" and object's IDs (so objects with the same ViewOrder will also be ordered by their ID).

3) Pass through the resulting list, rendering objects one by one.

If you order your objects/sprites at the moment of creation by inserting them in the right position, when there are hundreds of objects created and destroyed every frame, you will be having a major overhead (especially if only few of these objects are really visible on the screen). The idea of the above method is that only visible objects are ordered (and rendered).