CPU heat output is also affected by architecture and manufacturing process. For example, a Core i5 2500K overclocked to 3.2GHz would run a lot cooler than my old Pentium 4 at stock 3.2GHz because of the improvements in design and manufacture.
But yes, chips within the same generation will run hotter as they go faster, but not by any real noticeable degree - I don't see there being much difference in temperature between a i5 2300 and a i5 2500K at stock.
Also, the voltage that runs through it is a factor too. For instance, take 2 i5 2500K chips clocked at 4GHz. If one of them can do it at 1.1V but the other needs 1.3V then the latter will run hotter.