X has found the body of Y.
They were a detective.
In this particular case there may be an elegant gender-neutral translation, by not using a pronoun:
X hat die Leiche von Y gefunden.
Das Opfer war Detektiv.
Leiche (f.) ‘dead body’ and Opfer (n.) ‘victim’ don’t imply a certain sex.
Alternatively, it also works with using the name of course.
Y war Detektiv.
Using Detektiv as a predicative without indefinite article ein may still be considered sexist by some feminists, but I’ve yet to see a psycholinguistic study to prove there’s a (male) bias in this particular construct.
Evidence that there’s a bias in some constructs has frequently been (ab)used to justify critique of other constructs.
Neuter nouns like Opfer, Tier, Kind or Mädchen may always be referred to by masculine base forms of actor nouns (e.g. Detektiv), which they share most inflections with (“grammatical agreement”), but the derived feminine form (Detektivin) can also be used if the sex is known to be female (“natural agreement”) – the tendency to do so is growing.
Although Leiche is feminine, it would be (semantically) odd to refer to it with sie, because not the body but the person was a detective. Also, sie may be thought to refer to the name thereby determining the sex of Y.
X hat die Leiche von Y gefunden.
?Sie war Detektiv.
It would be less odd with Opfer.
X hat das Opfer gefunden.
Es war Detektiv.
Alas, a sentence starting with es war may easily be misunderstood to be using a filler es as in es war Sommer. The neuter relative pronoun may be better.
Dieses war Detektiv.
That’s still sounding unidiomatic, though, but with an adverbial or a full verb it becomes okayish.
Dieses war zu Lebzeiten Detektiv.
Dieses arbeitete als Detektiv.
An apposition could also be used instead. It may be introduced by a colon, en-dash or comma and it’s also possible to surround it by parentheses.
X hat die Leiche von Y gefunden – ein Detektiv.
X hat die Leiche von Y (Detektiv) gefunden.
Singular they
There is no direct equivalent to English singular they in German.
Since sie is already used for both, (feminine) ‘she’ and (plural) ‘they’, there can’t be.
On the other hand, German es (or other neuter pronouns) can be used a bit more freely to refer to human beings than English it.
It’s a detective.
Es ist ein Detektiv.
PS: I’ve used Detektiv as a translation of ‘detective’, but that’s a false friend if the rank or role within the police force was meant.