The answer provided by @ChrisAuer is 100% correct, but I wanted to share a little more detail with you, as well.
Taxonomy and Profiles
Sitecore includes support for personalizing and tracking a visitor against an indeterminate number of profiles at any given time. A profile can be thought of as a context for personalization.
As highlighted in the below image, Sitecore includes four different profiles out of the box: Focus, Function, Persona and Score. Each of these profiles have their own profile keys, pattern cards, and profile cards, and they can all be tracked and personalized against at the same time. This means that if you're tracking against 10 different profiles, then your visitor might actually have matched 10 different patterns, one for each profile.
Finding the Right Pattern
Given that your visitor might have any number of matched patterns but at most one for each profile, if you know the profile that you are looking to personalize against then you can find the singular pattern, if any, that the visitor matches for that profile.
This is where @ChrisAuer's solution comes into play:
- Retrieve the interaction profile from the visitor that matches the profile that you are looking to personalize against
- Ensure that the interaction profile is not null (it will be if the user has not yet been scoredfor the profile you are looking to personalize against)
- Check if the interaction profile has a
PatternId (holds the ID of the matched pattern, if any - automatically updated when visitor is scored for the profile)
- Retrieve the pattern card with the
PatternId from Sitecore and ensure that it is not null
Personalizing Components without Code
If you are looking to personalize renderings, you can use the native personalization tools to do so without any additional coding. You can do this using Conditional Renderings and the Rule Set Editor, which you can access from the page item's Layout Details.