Enharmonics is something of an art. It is not just what key you are in but where the chords are going. I might not notate something the way you would, but we would each have our reasons.
Sonar does enharmonics opposite of how I would in about 60% of the cases and I have to fix them all manually, but, in fairness, this would be very difficult to program.
Example: If I am in the key of A and playing a D minor chord (very common), I would expect to see an F natural. Sonar will normally go with E#—which would be correct if I were playing a C# maj chord.
All that said, a Db in the key of D is pretty far off. Hard to imagine many cases in which you would want that!
The ideal solution would be a showgirl assistant who makes me drinks and corrects all the enharmonics while I create hits that will live forever.