Yes, Even if you appear for a single paper out of two papers in the prelims, it will be considered as an attempt. The conducting body specifies the number of attempts allowed for candidates belonging to various categories.
Candidates belonging to an unreserved category can have a maximum number of 6 attempts.
Candidates belonging to OBC category have a total number of 9 attempts.
Physically handicapped candidates belonging to the General Category also have a total number of  9 attempts.
Candidates belonging to SC/ST category can make any number attempts in the UPSC IAS Exam.