The only way to find your EXACT SID is through cheats and hacking like an Action Replay.
Source: https://gamefaqs.gamespot.com/ds/925601-pokemon-diamond-version/answers/56176-how-do-i-find-my-sid
However, there is a way to get a range of 8 different SID's through deduction. To get this, there are 65536 SID numbers and 1/8192 chance to find a shiny. 65536/8192 is 8. Now for the process. However, you need to catch a shiny, not cheat it in or anything like that. This is because we need to find the Personality ID number of the Pokémon, which hacking affects. Now, get a whole bunch of Rare Candies and level the Pokémon up with those Rare Candies, the Pokémon can't have any EV's. Now, find an IV Calculator and use those Rare Candies until it gives you an exact IV value, no range. Now, go to a Personality ID Calculator (There is one on Seribii if you want) and enter the IVs and Nature and it will get a list of possible Personality IDs. Choose the correct one. Note that it will give 3 methods, and if it gives multiple possibilities for the same method, you will have to do this entire process over again and get the Personality ID that gives you the same SID at the end. Once you have the DEFINITE Personality ID, go to a Secret ID calculator on Seribii and the values it wants. Refer to my Source (1) for a more detailed explanation to enter the SID. This will yield the range of your SID, 8 values. Remember when I said that a Pokemon could yield 2 of the same ID Values for the same method? If this was the case, repeat entering your ID and the Pokemon's SID and look for a corresponding value(s). That is your SID/range of SIDs.
Source: https://forums.serebii.net/threads/find-your-secret-id-without-cheating.386016/