Hello
It depends which meaning of 'court' you're referring to. If you mean a court of law, then you say 'in court'. If you mean a Royal Court (i.e. a place where the king/queen live and receive guests), then you would say 'at court'. However, you will only really find people talking about being 'at court' in historical novels/films - it's not used nowadays.
Ellie.