If I am in the key of D major and I use a passing diminished 7th chord between D major and E minor, the resulting chord is an Ebdim7 or D#dim7? When I spell the chord using sharps it makes more sense: D#, F# A, B#? Would this be right?
To keep things simple it's best to stick with whatever is prevailing. Key D has sharps, so D♯ is a better root note than E♭.
Could even be construed as B7♭9 - which is a favourite to move to Em from.
Can't always be so, although often a chord is 'spelled wrongly' to make it easier to read and understand, even though it may be technically the wrong name.
But E♭ wouldn't be technically correct anyway - that belongs to a flat key.