24V stepper trouble, too many fried parts

Heatsinks can be chosen logically - they should specify a thermal resistance in degrees C / watt - so if you know the power dissipated you can determine the temperature rise above ambient. Fan-assisted cooling is much more efficient and can be useful if there isn't much room for heatsink(s).