I’ve scared myself at how fast I came up with a theory for as to how sherlock is alive. Heeerrrrrrrre is goes.
Sherlock organised the whole thing.
Before asking moriaty to meet on the roof he asked molly to get a body from the morgue and prepare it to look like sherlock had fallen from the roof. He then organised moriaty to meet on the roof already predicting how the events would pan out. He therefore arranged it just in time for a litter collect at the hospital, so as the small garbage truck which was adjacent to where the body was would catch his fall. Notice how no passers by flock to sherlocks body until AFTER John gets up off the floor disorientated. therefore giving molly the time to switch bodies and sherlock to remove himself from the scene, and the entire time sherlock urges john to stay in one place so his plan couldnt be foiled.