You sure ask some strange questions! I mean, it seams if you can determine the type of chip (6581/8580) then simple detection should be simple... Anyway, here is what I would do
sid = $d700 ;example SID base address
LDA #<sid
LDX #>sid
STA $FE ;any old zero-page address for pointer
STX $FF
LDA #0 ;reset value
LDY #7*2 ;start of voice 3 (frequency registers)
STA ($FE),Y ; voice 3 freq. low
INY
STA ($FE),Y ; voice 3 freq. high
INY
STA ($FE),Y ; voice 3 pulse-width low
INY
STA ($FE),Y; voice 3 pulse-width high
INY
LDA #$41 ;gate voice, pulse waveform
STA ($FE),Y ; gate voice 3
LDY #$1B ;voice 3 oscillator read-only register
LDA #$FF ;inversion of $00
CMP ($FE),Y
BNE no_sid
LDY #7*2+3 ;voice 3 pulse-width high
STA ($FE),Y ;set to $FF
LDY #$1B ;voice 3 oscillator read-only register
LDA ($FE),Y ;test inversion of $FF (test $00)
BNE no_sid
;SID present!
I have tried this in VICE with and without stereo SID. I also tested against VICE with normal SID and my real C128. All that works okay, but I do not have a real stereo SID to test.
I hope that helps!
Edit
I attached the test program. From MONITOR enter J1300. If SID is present, nothing happens. If SID is missing, then border will flash and you have to press STOP.