I've found that if I assault the city straight away, I normally don't get any damaged buildings at all. (Especially with elephants or spies opening up gates on first time)

If I wait out and siege the city I normally end up with damaged buildings. Even if I assault later on in a siege there are damaged buildings.

If I starve out a city completely I find about three quarters of buildings are damaged on average.

Seems proportional to how long you siege a city for but not sure on the precise formulae for working it out.