Hi Ravi,
I assume you mean the number of columns will grow linearly to the number of "course name"(s) you are interested in capturing with the logic.
A possible refactoring to make this scalable could be the following.
Defined a BKM "follows(s: Student, c: String)" with the logic:
count(s.courses[c]) > 0
This BKM can be used anywhere in order to check if the given student in the parameter, follows the course given in the parameter.
Ensure this BKM is also listed in the knowledgeRequirements of your table.
Then the table column is just student, and the content of the input entries in the table for the same column could be as such:
follows(?, "Math")
follows(?, "Science")
etc. based on your first table example
Hope this helps,
MM