Is there a way to detect 'change' transactions' and if so, how?
There are multiple ways to make an educated guess, but there are usually no ways to say definitively which output is change.
The most common is by looking at the address type. Most wallets send change back to the same address type as the outputs. So if I spend from a legacy address, the change will be sent back to a legacy address. If the other output is to a segwit address, then you can make an educated guess that the legacy output is the change. The next most common technique is looking at the value, as hosseinimr93 has said above. Payment amounts are more commonly a round value, say 0.001 BTC, while change amounts are more commonly made up of whatever is left over and so are not a round value, such as 0.0012918 BTC.
There are other more advanced techniques, such as looking for unnecessary inputs, looking at how the suspected change is later spent/consolidated, or looking at the some of the specifics of the transaction such as the sequence, locktime, or fee rate.
However, not only can you avoid all these things if you know what you are doing, but you can actively use them to specifically make your payment look like change and your change look like a payment.