This blog post will help you to identify packages (count) for which there is no advertisement created and not used these packages in any task sequence.Once you have the packages ,you can further take action whether you really need these packages to exist in SCCM or cleanup to save disk space and avoid unused packages in sccm.
SQL Query to run from SQL server management studio or use this to create report.
select PackageType =
When 0 Then 'Software Distribution Package'
When 3 Then 'Driver Package'
When 4 Then 'Task Sequence Package'
When 5 Then 'software Update Package'
When 6 Then 'Device Settings Package'
When 7 Then 'Virtual Package'
When 257 Then 'Image Package'
When 258 Then 'Boot Image Package'
When 259 Then 'OS Install Package'
COUNT(PackageType) as Total
packageID not in (select PackageID from dbo.v_Advertisement)and
PackageID not in (SELECT ReferencePackageID FROM v_TaskSequenceReferencesInfo)
group by PackageType